~(function () {
  /*   var audio = document.getElementById('audio');
    audio.src = '../music/aaa.mp3'
    audio.play();
    document.addEventListener("WeixinJSBridgeReady", function () {
      audio.load();
      audio.play();
    }, false);
   */


  document.addEventListener('DOMContentLoaded', function () {
    function audioAutoPlay() {
      var audio = document.getElementById('audio')
      audio.play()
      document.addEventListener(
        'WeixinJSBridgeReady',
        function () {
          audio.play()
        },
        false
      )
    }
    audioAutoPlay()
    $('.music-flag').click(function () {
      $(this).toggleClass('rotate-linear')
      if (audio.paused) {
        audio.play();
      } else {
        audio.pause();
      }
    })
  })

  if ($('body').height() < 610) {
    $('.slide-content').css('transform', 'scale(' + 0.91 + ')')
    $('.slide01-content').css('transform', 'scale(1)')
  }
  $('.slide01-l').addClass('bounceInLeft')
  $('.slide01-r').addClass('bounceInRight')
  $('.slide01-c').addClass('bounceInUp')
  var mySwiper = new Swiper('.swiper-container', {
    direction: 'vertical',
    onSlideChangeStart: function (swiper) {
      switch (swiper.activeIndex) {
        case 0:
          $('.slide01-content').removeClass('dn')
          $('.slide01-l').addClass('bounceInLeft')
          $('.slide01-r').addClass('bounceInRight')
          $('.slide01-c').addClass('bounceInUp')
          $('.slide02-content').addClass('dn')
          $('.slide02-top').removeClass('bounceInDown')
          $('.slode02-bottom').removeClass('bounceInUp')
          break
        case 1:
          $('.swiper-container').addClass('swiper-no-swiping')
          setTimeout(() => {
            $('.swiper-container').removeClass('swiper-no-swiping')
          }, 500)
          setTimeout(function () {
            $('.slide01-content').addClass('dn')
          }, 100)

          $('.slide01-l').removeClass('bounceInLeft')
          $('.slide01-r').removeClass('bounceInRight')
          $('.slide01-c').removeClass('bounceInUp')
          $('.slide03-content').addClass('dn')
          $('.flow-01').removeClass('bounceInLeft')
          setTimeout(() => {
            $('.slide02-top').addClass('bounceInDown')
            $('.slode02-bottom').addClass('bounceInUp')
            $('.slide02-content').removeClass('dn')
          }, 500);
          $('.flow-02')
            .removeClass('bounceInRight')
            .addClass('dn')
          $('.flow-03')
            .removeClass('bounceInUp')
            .addClass('dn')
          $('.desc').fadeOut()

          break
        case 2:
          $('.swiper-container').addClass('swiper-no-swiping')
          setTimeout(() => {
            $('.swiper-container').removeClass('swiper-no-swiping')
          }, 500)
          setTimeout(function () {
            $('.slide02-content').addClass('dn')
          }, 1000)
          $('.slide03-content').removeClass('dn')
          $('.slide02-top').removeClass('bounceInDown')
          $('.slode02-bottom').removeClass('bounceInUp')
          setTimeout(() => {
            $('.flow-01').addClass('bounceInLeft')
          }, 0)
          setTimeout(() => {
            $('.flow-02')
              .addClass('bounceInRight')
              .removeClass('dn')
          }, 500)
          setTimeout(() => {
            $('.flow-03')
              .addClass('bounceInUp')
              .removeClass('dn')
          }, 1000)
          setTimeout(() => {
            $('.desc').fadeIn(1000, function () {})
            $('.swiper-container').removeClass('swiper-no-swiping')
          }, 2000)
          $('.slide04-flow-list1').fadeOut()
          $('.slide04-flow-list2').fadeOut()
          $('.slide04-flow-list3').fadeOut()
          break
        case 3:
          $('.swiper-container').addClass('swiper-no-swiping')
          setTimeout(() => {
            $('.swiper-container').removeClass('swiper-no-swiping')
          }, 500)
          setTimeout(() => {
            $('.slide03-content').addClass('dn')
            $('.slide05-content').addClass('dn')
            $('.flow-01').removeClass('bounceInLeft')
            $('.flow-02')
              .removeClass('bounceInRight')
              .addClass('dn')
            $('.flow-03')
              .removeClass('bounceInUp')
              .addClass('dn')
            $('.desc').fadeOut()
            $('.slide05-desc01')
              .add('.slide05-desc02')
              .add('.slide05-desc03')
              .add('.slide05-desc04')
              .add('.slide05-desc05')
              .add('.slide05-desc06')
              .fadeOut()
          }, 0)
          $('.slide04-content').removeClass('dn')
          $('.slide04-flow-list1').fadeIn(300, function () {
            $('.slide04-flow-list2').fadeIn(300, function () {
              $('.slide04-flow-list3').fadeIn()
              $('.swiper-container').removeClass('swiper-no-swiping')
            })
          })
          break
        case 4:
          $('.swiper-container').addClass('swiper-no-swiping')
          setTimeout(() => {
            $('.swiper-container').removeClass('swiper-no-swiping')
          }, 500)
          $('.slide05-content').removeClass('dn')
          $('.slide04-flow-list1').fadeOut()
          $('.slide04-flow-list2').fadeOut()
          $('.slide04-flow-list3').fadeOut()
          $('.slide05-desc01').fadeIn(500, function () {
            $('.slide05-desc02').fadeIn(500, function () {
              $('.slide05-desc03').fadeIn(500, function () {
                $('.slide05-desc04').fadeIn(500, function () {
                  $('.slide05-desc05').fadeIn(500, function () {
                    $('.slide05-desc06').fadeIn()
                  })
                })
              })
            })
          })
          $('.content-for1').fadeOut()
          $('.content-for2').fadeOut()
          $('.content-for3').fadeOut()
          $('.content-t')
            .css('visibility', 'hidden')
            .removeClass('bounceInDown')
          $('.content-b')
            .addClass('dn')
            .removeClass('bounceInUp')
          break
        case 5:
          $('.swiper-container').addClass('swiper-no-swiping')
          setTimeout(() => {
            $('.swiper-container').removeClass('swiper-no-swiping')
          }, 500)
          $('.slide05-content').removeClass('dn')
          $('.slide05-desc01')
            .add('.slide05-desc02')
            .add('.slide05-desc03')
            .add('.slide05-desc04')
            .add('.slide05-desc05')
            .add('.slide05-desc06')
            .fadeOut()
          $('.advantage1')
            .add('.advantage2')
            .add('.advantage3')
            .add('.advantage4')
            .add('.advantage5')
            .fadeOut()
          setTimeout(() => {
            $('.content-for1').fadeIn(500, function () {
              $('.content-for2').fadeIn(500, function () {
                $('.content-for3').fadeIn(500, function () {
                  $('.content-t')
                    .css('visibility', 'inherit')
                    .addClass('bounceInDown')
                  setTimeout(() => {
                    $('.content-b')
                      .removeClass('dn')
                      .addClass('bounceInUp')
                  }, 500)
                })
              })
            })
          }, 500);


          break
        case 6:
          $('.swiper-container').addClass('swiper-no-swiping')
          setTimeout(() => {
            $('.swiper-container').removeClass('swiper-no-swiping')
          }, 500)
          $('.content-for1')
            .add('.content-for2')
            .add('.content-for3')
            .add('.garden')
            .add('.slide08-content-c-desc')
            .fadeOut()
          $('.content-t')
            .css('visibility', 'hidden')
            .removeClass('bounceInDown')
          $('.content-b')
            .addClass('dn')
            .removeClass('bounceInUp')
          $('.advantage1').fadeIn(500, function () {
            $('.advantage2').fadeIn(500, function () {
              $('.advantage3').fadeIn(500, function () {
                $('.advantage4').fadeIn(500, function () {
                  $('.advantage5').fadeIn(500, function () {})
                })
              })
            })
          })
          break
        case 7:
          $('.swiper-container').addClass('swiper-no-swiping')
          setTimeout(() => {
            $('.swiper-container').removeClass('swiper-no-swiping')
          }, 500)
          $('.advantage1')
            .add('.advantage2')
            .add('.advantage3')
            .add('.advantage4')
            .add('.advantage5')
            .add('.slide09-garden')
            .fadeOut()
          $('.slide09-content-c-desc').css('opacity', '0')
          setTimeout(() => {
            $('.garden').fadeIn(300, function () {
              $('.slide08-content-c-desc').fadeIn()
            })
          }, 300)
          break
        case 8:
          $('.swiper-container').addClass('swiper-no-swiping')
          setTimeout(() => {
            $('.swiper-container').removeClass('swiper-no-swiping')
          }, 500)
          $('.garden')
            .add('.slide08-content-c-desc')
            .fadeOut()
          setTimeout(() => {
            $('.slide09-garden').fadeIn(800, function () {
              $('.slide09-content-c-desc').animate({
                opacity: 1
              }, 1000)
            })
          }, 300)
          $('.content-c-01')
            .add('.content-c-02')
            .add('.content-c-03')
            .add('.content-c-04')
            .add('.content-c-05')
            .add('.content-c-06')
            .add('.content-c-07')
            .add('.content-c-08')
            .fadeOut()
          break
        case 9:
          $('.swiper-container').addClass('swiper-no-swiping')
          setTimeout(() => {
            $('.swiper-container').removeClass('swiper-no-swiping')
          }, 500)
          $('.slide09-content-c-desc').css('opacity', '0')
          $('.slide09-garden').fadeOut()
          setTimeout(() => {
            $('.content-c-01').fadeIn(500, function () {
              $('.content-c-02').fadeIn(500, function () {
                $('.content-c-03').fadeIn(500, function () {
                  $('.content-c-04').fadeIn(500, function () {
                    $('.content-c-05').fadeIn(500, function () {
                      $('.content-c-06').fadeIn(500, function () {
                        $('.content-c-07')
                          .add('.content-c-08')
                          .fadeIn()
                      })
                    })
                  })
                })
              })
            })
          }, 500)
          $('.slide11-r01')
            .add('.slide11-r02')
            .add('.slide11-r03')
            .fadeOut()
          break
        case 10:
          $('.swiper-container').addClass('swiper-no-swiping')
          setTimeout(() => {
            $('.swiper-container').removeClass('swiper-no-swiping')
          }, 500)
          $('.content-c-01')
            .add('.content-c-02')
            .add('.content-c-03')
            .add('.content-c-04')
            .add('.content-c-05')
            .add('.content-c-06')
            .add('.content-c-07')
            .add('.content-c-08')
            .fadeOut()
          setTimeout(() => {
            $('.slide11-r01').fadeIn(500, function () {
              $('.slide11-r02').fadeIn(500, function () {
                $('.slide11-r03').fadeIn()
              })
            })
          }, 500)
          $('.erweima').removeClass('rubberBand')
          break
        case 11:
          $('.swiper-container').addClass('swiper-no-swiping')
          setTimeout(() => {
            $('.swiper-container').removeClass('swiper-no-swiping')
          }, 500)
          $('.slide11-r01')
            .add('.slide11-r02')
            .add('.slide11-r03')
            .fadeOut()
          setTimeout(() => {
            $('.erweima').addClass('rubberBand')
          }, 500)

          break
      }
    }
  })


  var ipAddress = 'http://192.168.2.222:82'
  // var ipAddress = 'https://app.guobener.com'
  $.ajax({
    type: 'post',
    url: ipAddress + '/wap/wechat/wxValidate/getJsapiSigna?url=' + encodeURIComponent(location.href),
    dataType: 'json',
    crossDomain: true,
    success: function (res) {
      var wxConfig = {
          appId: '',
          timestamp: '',
          nonceStr: '',
          signature: ''
        },
        title = '万果供应链有限公司',
        desc = '管理自然资源，优化农业产能！',
        link = location.href.indexOf > 0 ? location.href.split('?')[0] : location.href,
        imgUrl = 'http://www.lusiya.com/images/share-logo.png'
      wxConfig.appId = res.appId
      wxConfig.timestamp = res.timestamp
      wxConfig.nonceStr = res.noncestr
      wxConfig.signature = res.signature
      wx.config({
        debug: false,
        appId: wxConfig.appId,
        timestamp: wxConfig.timestamp,
        nonceStr: wxConfig.nonceStr,
        signature: wxConfig.signature,
        jsApiList: [
          'onMenuShareAppMessage',
          'onMenuShareTimeline',
          'onMenuShareQQ',
          'onMenuShareWeibo',
          'onMenuShareQZone'
        ]
      })
      WXshare(title, link, imgUrl, desc)
    }
  })

  function WXshare(title, linkUrl, imgUrl, des) {
    wx.ready(function () {
      wx.onMenuShareTimeline({
        //朋友圈
        title: des,
        link: linkUrl,
        imgUrl: imgUrl
      })
      wx.onMenuShareAppMessage({
        //微信朋友
        title: title,
        desc: des,
        link: linkUrl,
        imgUrl: imgUrl,
        type: 'link',
        dataUrl: ''
      })
      wx.onMenuShareQQ({
        //分享到QQ
        title: title,
        desc: des,
        link: linkUrl,
        imgUrl: imgUrl
      })
      wx.onMenuShareWeibo({
        //分享到腾讯微博
        title: title,
        desc: des,
        link: linkUrl,
        imgUrl: imgUrl
      })
      wx.onMenuShareQZone({
        //QQ空间
        title: title,
        desc: des,
        link: linkUrl,
        imgUrl: imgUrl
      })
    })
  }


})($)
